/**
 * 哈希表-赎金信-力扣383
 */
public class Practice_18 {
    public static void main(String[] args) {
        String A="acaabr";
        String B="acabr";
        Boolean s=canConstruct(A,B);
        int k=0;
    }
    public static boolean canConstruct(String ransomNote, String magazine) {
        if(ransomNote==null||magazine==null||ransomNote.length()==0||magazine.length()==0){
            return false;
        }

        char[] A=ransomNote.toCharArray();
        char[] B=magazine.toCharArray();

        int[] Anum=new int[26];
        int[] Bnum=new int[26];
        for(int i=0;i<A.length;i++){
            int index=(int)A[i]-(int)('a');
            Anum[index]++;
        }

        for(int i=0;i<B.length;i++){
            int index=(int)B[i]-(int)('a');
            Bnum[index]++;
        }

        for(int i=0;i<Anum.length;i++){
            int k= Bnum[i]-Anum[i];
            if(k<0){
                return false;
            }

        }
        return true;

    }
}
